/*
 * Copyright (c) 2017-2021, Lindenis Tech. Ltd.
 * All rights reserved.
 *
 * File:
 *
 * Description: reliable data transfer
 *
 * Author:
 *      xiaoshujun@lindeni.com
 *
 * Create Date:
 *      2021/03/17
 *
 * History:
 *
 */

#ifndef __LIND_SOURCE_H__
#define __LIND_SOURCE_H__

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>
#include "lindnet.h"

#include "lindcomponent.h"

typedef enum _lindsource_type_e
{
    LINDSOURCE_RTP              = 0x0,
} lindsource_type_e;

typedef struct _rtpsource_config_t
{
    char                ip[32];
    short               port;

    av_enc_type_t       enc_type;

    lindnet_type_e      protocol;
    int                 mtu;

    int                 payload_type;

    void * user;
    int (*output)(void * user, av_frame2_t * p_frame, void * ext1, void * ext2);
} rtpsource_config_t;

typedef struct _lindsource_t
{
    void * priv;
    void (*close)(void * this);
} lindsource_t;

lindsource_t * rtpsource_create(void * p_config);
lindsource_t * lindsource_create(lindsource_type_e type, void * p_config);

#ifdef __cplusplus
}
#endif

#endif // __LIND_SOURCE_H__

